﻿package com.bn.NNYY;

import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;

public class FishingNet{
	Bitmap[] fishingnet;//渔网图片
	private boolean drawNetFlag=false;//是否绘制渔网的标志位
	private boolean catchFishFlag=false;//是否可以捕鱼的标志位
	private boolean fishNetIsBad=false;//渔网是否完好的标志位
	int pointx;//渔网图片左上点坐标
	int pointy;//渔网图片左上点坐标
	int i;
	int n;
	public FishingNet(Bitmap[] fishingnet)//随机变换角度时再改
	{
		this.fishingnet=fishingnet;
		this.i=0;
		
	}
	public void getXandY(int pointx,int pointy)//计算图片应该画在哪个位置
	{
		this.pointx=pointx-Constant.FISHING_NET_WIDTH/2;
		this.pointy=pointy-Constant.FISHING_NET_HEIGHT/2;
	}
	//绘制鱼的方法
	public void drawSelf(Canvas canvas,Paint paint,float offsetX,float offsetY)//绘制鱼的方法，继承该类的方法相同
	{
		canvas.drawBitmap(fishingnet[i], pointx+offsetX, pointy+offsetY, paint);//绘制渔网图片
	}
	
	
	
	public void setDrawNetFlag(boolean drawNetFlag) {//是否可以绘制渔网
		this.drawNetFlag = drawNetFlag;
		this.i=0;//让渔网图片变换为第一张图片
	}
	public boolean isDrawNetFlag() {
		return drawNetFlag;
	}
	public void setCatchFishFlag(boolean catchFishFlag) {//是否可以捕鱼
		if(n==0)
		{
			this.catchFishFlag = catchFishFlag;
			n++;
			return;
		}
		if(n>0&&n<8)
		{
			n++;
		}
		if(n>=8)
		{
			this.catchFishFlag = catchFishFlag;
			n=1;
		}


	}
	public boolean isCatchFishFlag() {
		return catchFishFlag;
	}
	public void setFishNetIsBad(boolean fishNetIsBad) {
		this.fishNetIsBad = fishNetIsBad;
	}
	public boolean isFishNetIsBad() {
		return fishNetIsBad;
	}
}
